﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.Configuration;

namespace SVAccountingWebUI
{
    public partial class _Default : BaseClasses.BasePage
    {

        //protected void Button1_Click(object sender, EventArgs e)
        //{
        //    EncryptConfig(true);
        //}
        protected void EncryptConfig(bool bEncrypt)
        {

            Configuration config = WebConfigurationManager.OpenWebConfiguration("/");
            ConfigurationSection appSettings = config.GetSection("connectionStrings");
            if (bEncrypt)
            {
                appSettings.SectionInformation.ProtectSection("DataProtectionConfigurationProvider");
            }
            else
            {
                appSettings.SectionInformation.UnprotectSection();
            }
            config.Save();
        }



        protected void Button2_Click(object sender, EventArgs e)
        {
            EncryptConfig(false);
        }
    }
     
}
